{extends file="./main.tpl"}
{block name=head}
<script type="text/javascript">
function statusChange(planningId,logSheetId,processNo,idStatus)
{
  var datastring = " planningId= " + planningId + "&logSheetId= " + logSheetId + "&processNo= " + processNo + "&status= " + idStatus;

	if(idStatus == 1)
	{
		if(confirm('Do you really want to make its status OK ??? '))
		{
			$.ajax({
		    url: "statusChange.php",
		    type: "POST",
		    data: datastring,
		    success: function(data){
		    	location.reload();
		    }
		  });
		}
	}
	else
	{
    $(".notOkSpan").append('');
		if(confirm('Do you really want to make its status NOT OK ??? '))
		{
			$.ajax({
		    url: "statusChange.php",
		    type: "POST",
		    data: datastring,
		    success: function(data){
		    	$(".notOkSpan").html(data);
		    }
		  });
		}
	}
}
</script>
{/block}
{block name=body}
<table width="100%">
<tr>
<td width="90%">
  <table border='0' width="100%" cellpadding='1' cellspacing='2' align='left'>
  <tr>
    <td colspan="12" class="table1" align="center">* * Log Sheet List * *</td>
  </tr>
  <tr>
  	<td  class="table1" align='center'>Furnace</td>
  	<td  class="table1" align='center'>Log Sheet No</td>
  	<td  class="table1" align='center'>Date</td>
  	<td  class="table1" align='center'>Party</td>
  	<td  class="table1" align='center'>Inc. Challan No.</td>
  	<td  class="table1" align='center'>Quantity</td>
  	<td  class="table1" align='center'>Weight</td>
  	<td  class="table1" align='center'>Material</td>
  	<td  class="table1" align='center'>Hardness Req.</td>
  	<td  class="table1" align='center'><b>Status</b></td>
  </tr>
  {section name="sec" loop=$logsArray}
  <tr id="{$smarty.section.sec.rownum}" class="trRow">
  	{if $logsArray[sec].processNo == 1}
    <td class="table2" align="center">{$logsArray[sec].furnace1}</td>
    {else if $logsArray[sec].processNo == 2}
    <td class="table2" align="center">{$logsArray[sec].furnace2}</td>
    {else if $logsArray[sec].processNo == 3}
    <td class="table2" align="center">{$logsArray[sec].furnace3}</td>
    {/if}
    <td class="table2" align="center">{$logsArray[sec].logsheetNo}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].logsheetDate}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].partyName}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].challan}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].quantity}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].weight}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].materialName}</td>
    <td class="table2" align="center" NOWRAP>{$logsArray[sec].hardne}</td>
  	<td class="table2" align="center" NOWRAP>
  		{if $logsArray[sec].status == -1}
  		  <input type="button" name="okBtn" value=" OK " id="okBtn" onclick="statusChange({$logsArray[sec].planningId},{$logsArray[sec].logSheetId},{$logsArray[sec].processNo},1);" />
  		  <input type="button" name="notOkBtn" value=" NOT OK " id="notOkBtn" onclick="statusChange({$logsArray[sec].planningId},{$logsArray[sec].logSheetId},{$logsArray[sec].processNo},-1);" />
  		  
  		{else}
  		  OK
  		{/if}  
    </td>
  </tr>
  {sectionelse}
  <tr>
    <td colspan="8" align="center">
      {$msg}
    </td>
  </tr> 
  {/section}
  </table>
</td>
<td width="5%" valign="bottom">
	<span class="notOkSpan"></span>
</td>
<tr>
</table>
{/block}